"use strict";
const utils_index = require("../utils/index.js");
const common_vendor = require("../common/vendor.js");
const defaultOptions = {
  show: false
};
const useGlobalLoading = common_vendor.defineStore("global-loading", {
  state: () => ({
    loadingOptions: defaultOptions,
    currentPage: ""
  }),
  getters: {},
  actions: {
    // 加载提示
    loading(option) {
      this.currentPage = utils_index.getCurrentPath();
      this.loadingOptions = common_vendor.deepMerge({
        iconName: "loading",
        duration: 0,
        cover: true,
        position: "middle",
        show: true
      }, typeof option === "string" ? { msg: option } : option);
    },
    // 关闭Toast
    close() {
      this.loadingOptions = defaultOptions;
      this.currentPage = "";
    }
  }
});
exports.useGlobalLoading = useGlobalLoading;
